const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {

        nameInfo: { left: '真实名字', value: "name", placeholder: '申请人名字', id: 0, flag: false },
        // idNumberInfo: { left: '身份证号',value:"idNumber", placeholder: '申请人身份证号',id:1 },
        // cardNumberInfo: { left: '储蓄卡号',value:"cardNumber", placeholder: '申请人储蓄卡号' ,id:2 },
        // addressDetailInfo: { left: '详细地址', value:"addressDetail",placeholder: '申请人详细地址',id:3  },

        address: [],
        name: '',
        idNumber: '',
        cardNumber: '',
        addressDetail: '',
        money: '',
        withdrawalModal: false,
        maskShowModel: false
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function (options) {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    },
    name: function (e) {
        this.setData({
            name: e.detail.value
        })
    },
    idNumber: function (e) {
        this.setData({
            idNumber: e.detail.value
        })
    },
    cardNumber: function (e) {
        this.setData({
            cardNumber: e.detail.value
        })
    },
    addressDetail: function (e) {
        this.setData({
            addressDetail: e.detail.value
        })
    },
    money: function (e) {
        this.setData({
            money:  e.detail.value
        })
    },
    addressChange: function (e) {
        console.log('picker发送选择改变，携带值为', e.detail.value)
        this.setData({
            address: e.detail.value
        })
    },
    clear: function (e) {
        console.log(e)
        var value = e.currentTarget.dataset.value;
        if (value == 0) {
            this.setData({
                name: ''
            })
        } else if (value == 1) {
            this.setData({
                idNumber: ''
            })

        } else if (value == 2) {
            this.setData({
                cardNumber: ''
            })
        } else if (value == 3) {
            this.setData({
                addressDetail: ''
            })
        } else {
            this.setData({
                money: ''
            })
        }

    },
    toShowModal: function (e) {
        this.setData({
            withdrawalModal: true,
            maskShowModel: true
        })
    },
    hiddenModels: function (e) {
        this.setData({
            withdrawalModal: false,
            maskShowModel: false
        })
    }
})